package com.example.combwx.mvp.view;

import android.graphics.Color;
import android.view.View;

import com.example.combwx.R;
import com.example.combwx.handler.TimerHandler;
import com.example.combwx.mvp.base.view.BaseActivity;
import com.example.combwx.mvp.contract.SplashContract;
import com.example.combwx.mvp.di.DaggerSplashComponent;
import com.example.combwx.mvp.di.SplashModules;
import com.example.combwx.mvp.presenter.SplashPresenter;
import com.example.combwx.test.BottomButtonActivity;
import com.example.combwx.thread.TimerThread;
import com.example.combwx.utils.LogUtils;

public class SplashAcitvity extends BaseActivity<SplashPresenter> implements SplashContract.ISplashVIew, TimerHandler.TimerCallBack {
    @Override
    public View addStatusView() {
        return f(R.id.splash_linear);
    }

    @Override
    public int addcolor() {
        return Color.WHITE;
    }

    @Override
    public int bindLayout() {
        return R.layout.activity_splash;
    }

    @Override
    public void initView() {

    }

    @Override
    public void initData() {
        //发送请求
        p.requestToken();
    }

    @Override
    public void inject() {
        DaggerSplashComponent.builder()
                .splashModules(new SplashModules(this))
                .build().injectSplash(this);
    }

    @Override
    public void refresh() {
        LogUtils.show("refresh");
        new TimerThread(new TimerHandler(this)).start();
    }

    @Override
    public void callBack() {
        //跳转页面
        startPage(BottomButtonActivity.class);
        finish();
    }
}
